//
//  Person.m
//  消息转发
//
//  Created by 崔博 on 2018/8/2.
//  Copyright © 2018年 崔博. All rights reserved.
//

#import "Person.h"
#import "Cat.h"
@implementation Person
- (id)forwardingTargetForSelector:(SEL)aSelector
{
    if (aSelector == @selector(test)) {
        return nil;
    }
    return [super forwardingTargetForSelector:aSelector];
}
// 方法签名：返回值烈性。参数类型
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
    NSLog(@"%@",aSelector);
    if (aSelector == @selector(test)) {
        return [NSMethodSignature signatureWithObjCTypes:"v16@0:8"];
    }
    return [super methodSignatureForSelector:aSelector];
}
// NSInvocation 封装了一个函数调用。包括：方法调用者，方法，方法参数
//    anInvocation.target
//    anInvocation.selector
//    [anInvocation getArgument:NULL atIndex:0];

- (void)forwardInvocation:(NSInvocation *)anInvocation
{
    [anInvocation invokeWithTarget:[[Cat alloc] init]];
}
- (void)doesNotRecognizeSelector:(SEL)aSelector
{
    
}
@end
